<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/templates/template_admin.xhtml">
        <ui:define name="content">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>
                <h1><h:outputText value="Create Department"/></h1>
                <h:panelGrid columns="2">
                    <h:outputLabel value="DepartmentID" for="departmentID" />
                    <h:inputText id="departmentID" value="#{dmb.department.departmentID}"  required="true" requiredMessage="You must enter departmentID"/>
                    <h:outputLabel value="Name" for="name" />
                    <h:inputText id="name" value="#{dmb.department.name}"  required="true" requiredMessage="You must enter name"/>
                    <h:outputLabel value="Email" for="email" />
                    <h:inputText value="#{dmb.department.email}"
                                 styleClass="text-input medium-input"
                                 id="email"
                                 required="true"
                                 requiredMessage="You must enter email address."
                                 validator="#{vlmb.validate}"/>
                    <h:outputLabel value="PhoneNumber" for="phoneNumber" />
                    <h:inputText id="phoneNumber" value="#{dmb.department.phoneNumber}" required="true" validator="#{vlmb.validatePhoneNumber}"/>
                    <h:outputLabel value="LeaderName" for="leaderName" />
                    <h:inputText id="leaderName" value="#{dmb.department.leaderName}"  />
                    <h:outputLabel value="Description" for="description" />
                    <h:inputText id="description" value="#{dmb.department.description}"  />
                </h:panelGrid>
                <br />
                <h:commandButton action="#{dmb.adddepart()}" value="Create" />
                <br />
                <br />
                <h:commandButton action="List" value="Back"/>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
